package it.polimi.traveldream.web.beans;

import it.polimi.traveldream.ejb.pacchettomanagement.FindDTO;
import it.polimi.traveldream.ejb.pacchettomanagement.PacchettoMgr;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

@ManagedBean(name="findBean")
@ViewScoped
public class FindBean {
		
	@EJB
	private PacchettoMgr pacchettoMgr;

	private FindDTO find;
	
	public FindBean(){
		find = new FindDTO();
	}

	public FindDTO getFind() {
		return find;
	}

	public void setFind(FindDTO find) {
		this.find = find;
	}
	
	public String findVolo(){
		find.setResult(pacchettoMgr.findVolo(find.getAeroportoPartenza(), find.getAeroportoArrivo()));
		//System.out.println("partenza "+find.getAeroportoPartenza());
		//System.out.println("arrivo "+find.getAeroportoArrivo());
		//System.out.println("risorsa "+pacchettoMgr.findVolo(find.getAeroportoPartenza(), find.getAeroportoArrivo()));
		return "home?faces-redirect=true";
	}

}
